import rxAjax from '@/assets/js/ajax.js';

//规则引擎组件 api接口
export const FormLiteComponentApi = {};

FormLiteComponentApi.baseUrl= '/api-form/form/core/formLiteComponent';
FormLiteComponentApi.exportUrl= FormLiteComponentApi.baseUrl + '/export';

//查询列表
FormLiteComponentApi.query=function (parameter) {
  var url= FormLiteComponentApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
* 获取单记录
* @param pkId
* @returns {*}
*/
FormLiteComponentApi.get =function(pkId) {
  var url= FormLiteComponentApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}

//保存数据
FormLiteComponentApi.save =function(parameter) {
  var url= FormLiteComponentApi.baseUrl + '/save';
  return rxAjax.postJson(url,parameter);
}

//删除数据
FormLiteComponentApi.del =function(parameter) {
  var url= FormLiteComponentApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}

//变更分类
FormLiteComponentApi.changeCategory=function(ids,categoryId){
    var url= FormLiteComponentApi.baseUrl+'/changeCategory';
    return rxAjax.postForm(url, {ids:ids,categoryId:categoryId});
}
export  default FormLiteComponentApi;

